<template>
    <div>
        <el-form :model="form">
            <el-form-item label="活动名称" label-width="80px">
                <el-input v-model="form.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="活动区域">
                <el-select v-model="form.region" placeholder="请选择活动区域">
                    <el-option label="区域一" value="shanghai"></el-option>
                    <el-option label="区域二" value="beijing"></el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <el-button @click="cancelForm">取 消</el-button>
        <el-button type="primary" @click="handleClose" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button>
    </div>
</template>

<script>
    export default {
        name: "elButtonTest",
        data() {
            return {
                form: {
                    name: '',
                    region: ''
                },
                loading: false
            }
        },
        methods: {
            handleClose() {
                if (this.loading) {
                    return;
                }
                this.loading = true;
                this.timer = setTimeout(() => {
                    this.loading = false;
                }, 2000);
            },
            cancelForm() {
                this.loading = false;
                this.dialog = false;
                clearTimeout(this.timer);
            }
        }
    }
</script>

<style scoped lang="less">

</style>